package br.com.myps3t;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public enum TrophyType {
	
	PLATINUM(180), 
	GOLD(90), 
	SILVER(30), 
	BRONZE(15),
	HIDDEN(0);
	
	private int points;
	
	TrophyType(int points) {
		this.points = points;
	}
	
	public int getPoints() {
		return this.points;
	}

	static TrophyType getByName(String typeTrophy) {

		if ( typeTrophy.equalsIgnoreCase("PLATINUM") )
			return TrophyType.PLATINUM;
		else if ( typeTrophy.equalsIgnoreCase("GOLD") )
			return TrophyType.GOLD;
		else if ( typeTrophy.equalsIgnoreCase("SILVER") )
			return TrophyType.SILVER;
		else if ( typeTrophy.equalsIgnoreCase("BRONZE") )
			return TrophyType.BRONZE;
		else
			return TrophyType.HIDDEN;

	}
	
	public String toString() {

		String retValue;
		
		switch(this.points) {
			case 180:
				retValue = "Platina";
				break;
	
			case 90:
				retValue = "Ouro";
				break;
	
			case 30:
				retValue = "Prata";
				break;
	
			case 15:
				retValue = "Bronze";
				break;
	
			default:
				retValue = "Oculto";
				break;
	
		}
	
		return retValue;

	}

	public Bitmap getImage() {

		Bitmap image;
		
		switch(this.points) {
			case 180:
				
				image = BitmapFactory.decodeResource(ActivityMyPS3T.getContext().getResources(), R.drawable.trophy_type_platinum);				
				break;

			case 90:
				image = BitmapFactory.decodeResource(ActivityMyPS3T.getContext().getResources(), R.drawable.trophy_type_gold);				
				break;

			case 30:
				image = BitmapFactory.decodeResource(ActivityMyPS3T.getContext().getResources(), R.drawable.trophy_type_silver);				
				break;

			case 15:
				image = BitmapFactory.decodeResource(ActivityMyPS3T.getContext().getResources(), R.drawable.trophy_type_bronze);				
				break;

			default:
				image = BitmapFactory.decodeResource(ActivityMyPS3T.getContext().getResources(), R.drawable.trophy_type_hidden);
				break;

		}

		return image;

	}
	
}